package First;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

public class ConsumInfo implements Serializable {
    public String cardNumber;    // 卡号
    public String type;         // 消费类型：通话/短信/上网
    public int consumData;      // 消费数据量(分钟/条数/MB)
    public double consumAmount; // 消费金额
   public Date consumDate;     // 消费日期

    public ConsumInfo(String cardNumber, String type, int consumData, double consumAmount) {
        this.cardNumber = cardNumber;
        this.type = type;
        this.consumData = consumData;
        this.consumAmount = consumAmount;
        this.consumDate = new Date();
    }
    public ConsumInfo(String cardNumber, String type, int consumData) {
        this.cardNumber = cardNumber;
        this.type = type;
        this.consumData = consumData;
    }

    @Override
    public String toString() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return "卡号:" + cardNumber +
                " 消费类型:" + type +
                " 消费数据量:" + consumData +
                " 消费金额:" + consumAmount + "元" +
                " 消费时间:" + sdf.format(consumDate);
    }
    // Getter方法
    public String getCardNumber() {
        return cardNumber;
    }

    public String getType() {
        return type;
    }

    public int getConsumData() {
        return consumData;
    }

    public double getConsumAmount() {
        return consumAmount;
    }

    public Date getConsumDate() {
        return consumDate;
    }
}